﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.ComponentModel;

namespace TinyCinema.UI
{
    /// <summary>
    /// Interaction logic for SplashScreen.xaml
    /// </summary>
    public partial class SplashScreen : Window
    {
        public static Main mainWindow;
        BackgroundWorker worker = new BackgroundWorker();        
        public SplashScreen()
        {
            InitializeComponent();
            worker.DoWork += worker_DoWork;
            worker.RunWorkerAsync();            
        }

        void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            Dispatcher.Invoke(new Action(() =>
            {
                mainWindow = new Main();
                mainWindow.Loaded += (s, ex) => this.Close();
                mainWindow.Show();
            }));
            
        }   
    }
}
